package cn.kgc.servlet;

import javax.servlet.annotation.WebServlet;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(urlPatterns = "/userServlet")
public class UserServletServlet extends javax.servlet.http.HttpServlet {


    protected void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        String name = request.getParameter("name");
        System.out.println(name);
        boolean used;
        if ("111".equals(name)) {
            //用户名已经存在
            used = true;
        } else {
            used = false;
        }

        response.setContentType("text/html;charset=UTF-8");
        PrintWriter printWriter = response.getWriter();
        printWriter.print(used);
        printWriter.flush();
        printWriter.close();
    }
}



